//
// Created by Jisam on 2024/7/13.
//
#include <bits/stdc++.h>
#define PSI pair<string,int>
#define PII pair<int,int>
#define x first
#define y second
#define i64 long long
using namespace std;
const int N = 1e5 + 5;
int ans;
struct node{
    int ap,bp,as,bs;
};
void push(node n1, vector<node> & own){
    node n2{};
    n2.ap = n1.ap;
    n2.bp = n1.bp;
    n2.as = n1.as;
    n2.bs = n1.bs;
    own.push_back(n2);
}
void solve() {
    int T, MaxP, W;
    cin >> T >> MaxP >> W;
    vector<node> a(T);
    vector<node> own;
    for (int i = 0; i < T; i++)
    {
        cin >> a[i].ap >> a[i].bp >> a[i].as >> a[i].bs;
    }
    int tp = 0;
    int tw = 0;
    for (int i = 0; i < T; i++)
    {
        if (tw < W) {
            tw++;
            continue;
        }
        if(tp < MaxP){
            push(a[i],own);
        }
        for(int j = 0; j < own.size(); i ++){
            if(a[i].bp > own[j].ap){

            }
        }
    }
    cout << ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
//    int T;cin >> T;while(T --)
        solve();
    return 0;
}